package com.auxgroup.hr.front.dozer;

import java.util.Collection;

import com.auxgroup.hr.front.dozer.exception.MappingException;

/**
 * 对象mapper工具类
 */
public interface IObjectMapper {
	/**
	 * Constructs new instance of destinationClass and performs mapping between
	 * from source
	 * 
	 * @param source
	 * @param destinationClass
	 * @param <T>
	 * @return
	 * @throws MappingException
	 */
	<T> T map(Object source, Class<T> destinationClass) throws MappingException;

	/**
	 * Performs mapping between source and destination objects
	 * 
	 * @param source
	 * @param destination
	 * @throws MappingException
	 */
	void map(Object source, Object destination) throws MappingException;

	/**
	 * Constructs new instance of destinationClass and performs mapping between
	 * from source
	 * 
	 * @param source
	 * @param destinationClass
	 * @param mapId
	 * @param <T>
	 * @return
	 * @throws MappingException
	 */
	<T> T map(Object source, Class<T> destinationClass, String mapId)
			throws MappingException;

	/**
	 * Performs mapping between source and destination objects
	 * 
	 * @param source
	 * @param destination
	 * @param mapId
	 * @throws MappingException
	 */
	void map(Object source, Object destination, String mapId)
			throws MappingException;

	/**
	 * @since 1.1.0
	 * @param <T>
	 * @param source
	 * @param dest
	 * @throws MappingException
	 */
	<T> void map(Collection<?> source, Collection<T> dest,
			Class<T> destinationClass) throws MappingException;

	/**
	 * @since 1.1.0
	 * @param <T>
	 * @param source
	 * @param dest
	 * @param mapId
	 * @throws MappingException
	 */
	<T> void map(Collection<?> source, Collection<T> dest,
			Class<T> destinationClass, String mapId) throws MappingException;

	/**
	 * @since 1.1.0
	 * @param <T>
	 * @param source
	 * @param destinationClass
	 * @param destinationCollectionClass
	 * @return
	 * @throws MappingException
	 */
	@SuppressWarnings("rawtypes")
	<T> Collection<T> map(Collection<?> source, Class<T> destinationClass,
			Class<? extends Collection> destinationCollectionClass)
			throws MappingException;

	/**
	 * @since 1.1.0
	 * @param <T>
	 * @param source
	 * @param destinationClass
	 * @param destinationCollectionClass
	 * @param mapId
	 * @return
	 * @throws MappingException
	 */
	@SuppressWarnings("rawtypes")
	<T> Collection<T> map(Collection<?> source, Class<T> destinationClass,
			Class<? extends Collection> destinationCollectionClass, String mapId)
			throws MappingException;

}
